﻿using System.Web;
using uForum.Businesslogic.Services;

namespace uForum.Library
{
	public class Rest
	{

		public static string NewTopic(int forumId)
		{

			PostingService postingService = new PostingService();
			string title = HttpContext.Current.Request["title"];
			string body = HttpContext.Current.Request["body"];

			return postingService.NewTopic(forumId, title, body);
		}

		public static string NewComment(int topicId, int itemsPerPage)
		{

			PostingService postingService = new PostingService();

			string body = HttpContext.Current.Request["body"];
			return postingService.NewComment(topicId, itemsPerPage, body);

		}

		public static string DeleteComment(int commentId)
		{
			PostingService postingService = new PostingService();
			return postingService.DeleteComment(commentId) ? "1" : "0";
		}

		public static string DeleteTopic(int topicId)
		{
			PostingService postingService = new PostingService();
			return postingService.DeleteTopic(topicId) ? "1" : "0";
		}

	}
}
